﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Data;
using System.Windows.Documents;
using System.Windows.Input;
using System.Windows.Media;
using System.Windows.Media.Imaging;
using System.Windows.Navigation;
using System.Windows.Shapes;
using MarketDashboardModule.Helpers;
using System.Collections.ObjectModel;
using MarketDashboardModule.Models;
using System.ComponentModel;
using MarketDashboardModule.ViewModels;
using System.ComponentModel.Composition;

namespace MarketDashboardModule.Views
{
    /// <summary>
    /// Interaction logic for UserControl1.xaml
    /// </summary>
    [Export(typeof(UserControl1))]
    public partial class UserControl1 : UserControl
    {
        public UserControl1()
        {
            InitializeComponent();
            this.DataContext = new MyViewModel();
            this.txtSearch.TextChanged +=new TextChangedEventHandler(txtSearch_TextChanged);
        }

        private void txtSearch_TextChanged(object sender, System.Windows.Controls.TextChangedEventArgs e)
        {
            string searchText = (sender as TextBox).Text;
            MyViewModel vm = this.DataContext as MyViewModel;
            vm.RefreshData(searchText);            
        }
      
    }

    
}
